package Demo19;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 洪汤泽大帅哥
 * Date: 2024-12-20
 * Time: 15:34
 */
import java.util.Scanner;

class Player{
    String name;
    Player(String name){
        this.name = name;
    }
    int show() {  //出拳方法
        int show = ( int ) (Math.random() * 10 ) %3  +1;
        return show ;
    }
}
class ComputerPlayer extends Player{

    ComputerPlayer(String name) {
        super(name);
    }
}
class PersonPlayer extends Player{

    PersonPlayer(String name) {
        super(name);
    }
}
class Game{
    private ComputerPlayer computerPlayer;
    private PersonPlayer personPlayer;

    public Game(ComputerPlayer computerPlayer, PersonPlayer personPlayer) {
        this.computerPlayer = computerPlayer;
        this.personPlayer = personPlayer;
    }
    void start(){
        Scanner sc =new Scanner(System.in);
        int p = sc.nextInt();;
        int c = computerPlayer.show();
        if ((c == 1 && p == 3) || (c == 2 && p == 1) || (c == 3 && p == 2)) {
            System.out.println("Winner is computerPlayer.");
        }
        else if ((p == 1 && c == 3) || (p == 2 && c == 1) || (p == 3 && c == 2)) {
            System.out.println("Winner is personPlayer.");
        }
        else {
            System.out.println("A Draw.");
        }
        sc.close();
    }
}

public class Main {

    public static void main(String[] args) {
        ComputerPlayer c = new ComputerPlayer ("computer");
        PersonPlayer  p = new PersonPlayer("player ") ;
        Game g = new Game( c ,p );
        g.start();
    }

}